﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows;
using System.Windows.Media.Imaging;


//```Csharp
//            // begin
//            Bitmap b = new Bitmap(128, 128);
//var corners = new Point[] {
//                new Point(1,1),
//                new Point(200,20),
//                new Point(2,15)};
//using (Graphics g = Graphics.FromImage(b))
//{
//    g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
//    g.Clear(System.Drawing.Color.Black);
//    g.FillPolygon(System.Drawing.Brushes.White, corners);
//}
//// end
//byte[,] mask = new byte[b.Width, b.Height];

//for (int y = 0; y < b.Height; y++)
//    for (int x = 0; x < b.Width; x++)
//    {
//        mask[x, y] = b.GetPixel(x, y).R > 0 ? (byte)1 : (byte)0;
//    }

//Console.WriteLine(mask[16, 17]);

//```

namespace WpfApp1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        #region bitData数组
        public static double[] bitData = new double[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0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            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            32.3873632024588,32.3873573615856,32.3872225190826,32.3855780873982,32.3736372362455,32.3167586969375,32.1246124360387,31.6351813772653,30.6517160393832,29.0477296932131,26.9075475098725,24.632498970519,22.9281165309021,22.6044682122229,24.1913207895886,27.4838821291705,31.2321394547189,33.1826495642317,30.5441589605925,20.7475498618996,2.23488245959197,0,0,0,0,0,0,0,0,22.3536904370076,150.82280549245,297.729120259681,440.481152580642,549.050913185473,588.79690549738,524.26199818862,323.509088779686,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10.4857887545895,15.1414148373442,14.1654715915865,11.1847088721161,11.9775660651139,24.3098728205287,57.3100246888725,120.027763680677,219.04909019039,355.494855503491,522.157373497539,701.669940551348,866.371366010226,980.061921073961,1001.40717472372,888.508503075516,604.110360582782,120.899321028604,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9.72873555899605,165.568413970816,357.599226692791,575.740855526234,798.256844996529,991.677195181941,1112.93031115175,1113.40621128104,944.386666741432,563.208538844792,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60.2358664004605,350.046615603775,632.582029732884,867.652686706598,1004.47928473675,986.506916762532,757.788150295086,270.186455593562,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,331.216465987052,631.490492192275,802.081100369278,777.629924522993,494.410427710763,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26.5694640994916,432.473965789222,671.912744984616,669.5548439002,353.064415602821,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,332.046395717636,700.653259480086,774.613511604621,471.716660559199,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,230.995856978494,822.266295862271,1061.36297057025,854.363827711051,126.418967102274,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,813.232064217706,1345.70828691375,1358.17105208062,765.444830004395,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,359.386617679982,1349.3350715175,1743.36342257572,1443.23047242687,392.728758827845,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,787.893703667447,1751.04575669999,1929.10327590529,1255.59313587262,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1165.17837501242,2014.98293217513,1910.1174850691,839.595617121494,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1537.51327583208,2182.05147817303,1750.32525119152,307.674224632172,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,375.628302086945,1921.06258447664,2281.8268764071,1519.47846144924,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,999.220737841695,2268.84263750771,2306.30527955989,1265.78861148731,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1569.38600493554,2487.20686077002,2223.19674019837,1017.44183504046,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83.0681571955538,1922.17485743936,2482.9223923354,2007.30741537458,793.519297265683,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,532.862843023893,1932.20495656472,2208.10139730693,1661.8813767085,605.595630837974,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,537.609253065038,1557.88744901923,1679.69887381833,1217.3052649537,449.100834221743,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85.1503186622858,852.689856233106,969.691099425755,714.606879283238,297.809865152961,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,177.407625148171,189.915376061973,113.003276997528,16.641102668945,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.338784610714548,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13.645102935061,128.694586354453,216.587357637178,281.908727255171,327.756006769223,355.924236586936,367.705305584723,364.771349130777,349.577182721124,325.208662311349,294.937363113374,261.770627462831,228.157578413693,195.879752361758,166.081855392401,139.379685761172,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,70.6147445757069,235.305879435999,349.362378304668,420.787498095829,456.789792767669,464.291224261243,450.125408729948,420.829035701327,382.248993878956,339.211676940379,295.376640064705,253.27475864013,214.469305335815,179.769591003012,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39.2806148465479,175.632177649136,261.861899973002,308.425007465946,324.897420999934,319.861400858854,300.658266236672,273.202740270281,241.955970488129,210.051499031398,179.51658654898,151.525624486731,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8.7416193399049,71.8739735101626,107.230126605983,122.899040655638,125.381314318598,119.651920289852,109.329540362832,96.9107819079322,84.0207716882685,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.94699943497835,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.242260355368671,0.615334085648101,0.759298016913817,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.85645640218718,6.28377676447235,8.4427773557527,9.077034045039,8.79126704727332,8.01889142159143,7.04231652764838,6.03043659007244,5.07497509328277,
            16.7217643562763,16.7174033727788,16.6167115532007,15.3881646130612,6.4559379186685,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21.8329084099514,36.8532192318744,24.3127247860066,9.53715964067487,0.990599143509826,0,4.09726861835588,10.685922084409,16.9663433297665,21.3903807696915,23.5111115053169,23.607005752001,22.2634923819678,20.0832314116715,17.5475075065733,14.9832701490968,12.583024935695,10.4412971992588,8.58934141723603,
             };
        #endregion
        public static Bitmap bitmap;
        public const int width = 64;
        public const int height = 64;
        public static Bitmap bitmapcopy;
        public static System.Drawing.Point[] pointRound { get; set; }
        public static int[,] integers = new int[width, height];

        #region PointAppend
        public static System.Drawing.Point[] PointAppend()
        {
            //System.Drawing.Point[] pointRound = new System.Drawing.Point[79];
            //IEnumerable<System.Drawing.Point> enu = new System.Drawing.Point[79];
            //foreach (System.Drawing.Point elem in enu)
            //{
            //    object item = elem;
            //    item = new System.Drawing.Point(11,11);
            //}


            System.Drawing.Point p0 = new System.Drawing.Point(22, 41);
            System.Drawing.Point p1 = new System.Drawing.Point(19, 41);
            System.Drawing.Point p2 = new System.Drawing.Point(18, 41);
            System.Drawing.Point p3 = new System.Drawing.Point(16, 40);
            System.Drawing.Point p4 = new System.Drawing.Point(14, 38);
            System.Drawing.Point p5 = new System.Drawing.Point(12, 37);
            System.Drawing.Point p6 = new System.Drawing.Point(12, 36);
            System.Drawing.Point p7 = new System.Drawing.Point(11, 35);
            System.Drawing.Point p8 = new System.Drawing.Point(11, 34);
            System.Drawing.Point p9 = new System.Drawing.Point(11, 33);
            System.Drawing.Point p10 = new System.Drawing.Point(11, 31);
            System.Drawing.Point p11 = new System.Drawing.Point(12, 30);
            System.Drawing.Point p12 = new System.Drawing.Point(13, 29);
            System.Drawing.Point p13 = new System.Drawing.Point(14, 28);
            System.Drawing.Point p14 = new System.Drawing.Point(15, 28);
            System.Drawing.Point p15 = new System.Drawing.Point(16, 27);
            System.Drawing.Point p16 = new System.Drawing.Point(16, 26);
            System.Drawing.Point p17 = new System.Drawing.Point(17, 26);
            System.Drawing.Point p18 = new System.Drawing.Point(18, 26);
            System.Drawing.Point p19 = new System.Drawing.Point(18, 26);
            System.Drawing.Point p20 = new System.Drawing.Point(19, 26);
            System.Drawing.Point p21 = new System.Drawing.Point(21, 26);
            System.Drawing.Point p22 = new System.Drawing.Point(22, 26);
            System.Drawing.Point p23 = new System.Drawing.Point(24, 26);
            System.Drawing.Point p24 = new System.Drawing.Point(25, 27);
            System.Drawing.Point p25 = new System.Drawing.Point(27, 28);
            System.Drawing.Point p26 = new System.Drawing.Point(29, 28);
            System.Drawing.Point p27 = new System.Drawing.Point(30, 30);
            System.Drawing.Point p28 = new System.Drawing.Point(32, 31);
            System.Drawing.Point p29 = new System.Drawing.Point(32, 31);
            System.Drawing.Point p30 = new System.Drawing.Point(33, 32);
            System.Drawing.Point p31 = new System.Drawing.Point(34, 33);
            System.Drawing.Point p32 = new System.Drawing.Point(35, 34);
            System.Drawing.Point p33 = new System.Drawing.Point(36, 34);
            System.Drawing.Point p34 = new System.Drawing.Point(37, 36);
            System.Drawing.Point p35 = new System.Drawing.Point(38, 37);
            System.Drawing.Point p36 = new System.Drawing.Point(38, 39);
            System.Drawing.Point p37 = new System.Drawing.Point(39, 40);
            System.Drawing.Point p38 = new System.Drawing.Point(39, 41);
            System.Drawing.Point p39 = new System.Drawing.Point(40, 42);
            System.Drawing.Point p40 = new System.Drawing.Point(40, 43);
            System.Drawing.Point p41 = new System.Drawing.Point(40, 44);
            System.Drawing.Point p42 = new System.Drawing.Point(40, 44);
            System.Drawing.Point p43 = new System.Drawing.Point(40, 44);
            System.Drawing.Point p44 = new System.Drawing.Point(40, 45);
            System.Drawing.Point p45 = new System.Drawing.Point(39, 45);
            System.Drawing.Point p46 = new System.Drawing.Point(39, 46);
            System.Drawing.Point p47 = new System.Drawing.Point(38, 47);
            System.Drawing.Point p48 = new System.Drawing.Point(38, 47);
            System.Drawing.Point p49 = new System.Drawing.Point(38, 47);
            System.Drawing.Point p50 = new System.Drawing.Point(38, 47);
            System.Drawing.Point p51 = new System.Drawing.Point(37, 47);
            System.Drawing.Point p52 = new System.Drawing.Point(36, 47);
            System.Drawing.Point p53 = new System.Drawing.Point(35, 47);
            System.Drawing.Point p54 = new System.Drawing.Point(35, 47);
            System.Drawing.Point p55 = new System.Drawing.Point(33, 47);
            System.Drawing.Point p56 = new System.Drawing.Point(33, 47);
            System.Drawing.Point p57 = new System.Drawing.Point(32, 46);
            System.Drawing.Point p58 = new System.Drawing.Point(31, 46);
            System.Drawing.Point p59 = new System.Drawing.Point(30, 45);
            System.Drawing.Point p60 = new System.Drawing.Point(30, 45);
            System.Drawing.Point p61 = new System.Drawing.Point(29, 44);
            System.Drawing.Point p62 = new System.Drawing.Point(28, 43);
            System.Drawing.Point p63 = new System.Drawing.Point(27, 43);
            System.Drawing.Point p64 = new System.Drawing.Point(26, 42);
            System.Drawing.Point p65 = new System.Drawing.Point(26, 42);
            System.Drawing.Point p66 = new System.Drawing.Point(26, 42);
            System.Drawing.Point p67 = new System.Drawing.Point(25, 42);
            System.Drawing.Point p68 = new System.Drawing.Point(25, 42);
            System.Drawing.Point p69 = new System.Drawing.Point(25, 42);
            System.Drawing.Point p70 = new System.Drawing.Point(25, 42);
            System.Drawing.Point p71 = new System.Drawing.Point(24, 42);
            System.Drawing.Point p72 = new System.Drawing.Point(24, 42);
            System.Drawing.Point p73 = new System.Drawing.Point(24, 41);
            System.Drawing.Point p74 = new System.Drawing.Point(24, 41);
            System.Drawing.Point p75 = new System.Drawing.Point(24, 41);
            System.Drawing.Point p76 = new System.Drawing.Point(24, 41);
            System.Drawing.Point p77 = new System.Drawing.Point(24, 41);
            System.Drawing.Point p78 = new System.Drawing.Point(22, 41);

            System.Drawing.Point[] pointRound = { p78, p77, p76, p75, p74, p73, p72, p71, p70, p69, p68, p67, p66, p65, p64, p63, p62, p61, p60, p59, p58, p57, p56, p55, p54, p53, p52, p51, p50, p49, p48, p47, p46, p45, p44, p43, p42, p41, p40, p39, p38, p37, p36, p35, p34, p33, p32, p31, p30, p29, p28, p27, p26, p25, p24, p23, p22, p21, p20, p19, p18, p17, p16, p15, p14, p13, p12, p11, p10, p9, p8, p7, p6, p5, p4, p3, p2, p1, p0 };
            
            return pointRound;
        }
        #endregion

        public static Graphics g;

        public MainWindow()
        {
            InitializeComponent();
            pointRound = PointAppend();
           // IEnumerable<System.Drawing.Point> enu = pointRound;
            foreach (var item in pointRound)
            {
                text.Text += "(" + item.X.ToString() + ","+item.Y.ToString() + ")";
            }
            BitmapSource bi2 = MethodRound();
            myimageCont1.Source = bi2;

            SolidBrush redBrush = new SolidBrush(Color.Red);
            g = Graphics.FromImage(bitmap);
            g.FillPolygon(redBrush, pointRound);
            //创建GDI对象，返回指针。
            IntPtr myImagePtr = bitmap.GetHbitmap();
            //创建imageSource
            myimageCont2.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(myImagePtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            DeleteObject(myImagePtr);
            string ShowRedBrush = String.Format("({0,-3},{1,3},{2,3})\n", redBrush.Color.R.ToString(), redBrush.Color.G.ToString(), redBrush.Color.B.ToString());
            text.Text += ShowRedBrush;
            for (int X = 0; X < width; X++)
            {
                for (int Y = 0; Y < height; Y++)
                {
                    if (bitmap.GetPixel(Y, X).R == 255 && bitmap.GetPixel(Y, X).G == 0 && bitmap.GetPixel(Y, X).B == 0)
                    {
                        //string tmp = String.Format("({0,-4},{1,4})", Y, X);
                        string tmpColor = String.Format("({0,-3},{1,3},{2,3}),({3},{4},{5})\t", bitmap.GetPixel(Y, X).R.ToString(), bitmap.GetPixel(Y, X).G.ToString(), bitmap.GetPixel(Y, X).B.ToString(),
                            BitConverter.GetBytes(integers[Y, X])[0], BitConverter.GetBytes(integers[Y, X])[1], BitConverter.GetBytes(integers[Y, X])[2]);
                        text.Text += tmpColor;
                    }
                }
                text.Text += "\n";
            }
        }

        [System.Runtime.InteropServices.DllImport("gdi32.dll")]
        public static extern bool DeleteObject(IntPtr hObject);

        public static BitmapSource MethodRound()
        {
            int[] dataInt = Array.ConvertAll(bitData, value => Convert.ToInt32(value));
            int width = (int)Math.Pow(dataInt.Length, 0.5);
            int height = (int)Math.Pow(dataInt.Length, 0.5);
            int tmp = 0;
            int stride = width * 4;

            BitmapSource imagesource;
            PointAppend();

            for (int X = 0; X < width; X++)
            {
                for (int Y = 0; Y < height; Y++)
                {
                    tmp = dataInt[X * width + Y];
                    byte[] rgba = new byte[] { (byte)255, (byte)0, (byte)(tmp * 255 / dataInt.Max()), 255 };
                    if (pointRound.Contains(new System.Drawing.Point(X, Y)))
                        rgba = new byte[] { (byte)105, (byte)100, (byte)100, 255 };
                    integers[Y, X] = BitConverter.ToInt32(rgba, 0);
                    
                }
            }
            //16776961

            unsafe
            {
                fixed (int* intPtr = &integers[0, 0])
                {
                    bitmap = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format32bppRgb, new IntPtr(intPtr));
                    
                    bitmapcopy = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format32bppRgb, new IntPtr(intPtr));

                    IntPtr myImagePtr = bitmap.GetHbitmap();//创建GDI对象，返回指针
                    //创建imageSource
                    imagesource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(myImagePtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                    DeleteObject(myImagePtr);
                }
            }
            return imagesource;
        }

    }
}

//namespace WpfApp1
//{
//    /// <summary>
//    /// Interaction logic for MainWindow.xaml
//    /// </summary>
//    public partial class MainWindow : Window
//    {
//        #region bitData数组
//        public static double[] bitData = new double[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            32.3873632024588,32.3873573615856,32.3872225190826,32.3855780873982,32.3736372362455,32.3167586969375,32.1246124360387,31.6351813772653,30.6517160393832,29.0477296932131,26.9075475098725,24.632498970519,22.9281165309021,22.6044682122229,24.1913207895886,27.4838821291705,31.2321394547189,33.1826495642317,30.5441589605925,20.7475498618996,2.23488245959197,0,0,0,0,0,0,0,0,22.3536904370076,150.82280549245,297.729120259681,440.481152580642,549.050913185473,588.79690549738,524.26199818862,323.509088779686,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10.4857887545895,15.1414148373442,14.1654715915865,11.1847088721161,11.9775660651139,24.3098728205287,57.3100246888725,120.027763680677,219.04909019039,355.494855503491,522.157373497539,701.669940551348,866.371366010226,980.061921073961,1001.40717472372,888.508503075516,604.110360582782,120.899321028604,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9.72873555899605,165.568413970816,357.599226692791,575.740855526234,798.256844996529,991.677195181941,1112.93031115175,1113.40621128104,944.386666741432,563.208538844792,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60.2358664004605,350.046615603775,632.582029732884,867.652686706598,1004.47928473675,986.506916762532,757.788150295086,270.186455593562,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,331.216465987052,631.490492192275,802.081100369278,777.629924522993,494.410427710763,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26.5694640994916,432.473965789222,671.912744984616,669.5548439002,353.064415602821,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,332.046395717636,700.653259480086,774.613511604621,471.716660559199,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,230.995856978494,822.266295862271,1061.36297057025,854.363827711051,126.418967102274,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,813.232064217706,1345.70828691375,1358.17105208062,765.444830004395,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,359.386617679982,1349.3350715175,1743.36342257572,1443.23047242687,392.728758827845,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,787.893703667447,1751.04575669999,1929.10327590529,1255.59313587262,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1165.17837501242,2014.98293217513,1910.1174850691,839.595617121494,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1537.51327583208,2182.05147817303,1750.32525119152,307.674224632172,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,375.628302086945,1921.06258447664,2281.8268764071,1519.47846144924,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,999.220737841695,2268.84263750771,2306.30527955989,1265.78861148731,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1569.38600493554,2487.20686077002,2223.19674019837,1017.44183504046,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83.0681571955538,1922.17485743936,2482.9223923354,2007.30741537458,793.519297265683,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,532.862843023893,1932.20495656472,2208.10139730693,1661.8813767085,605.595630837974,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,537.609253065038,1557.88744901923,1679.69887381833,1217.3052649537,449.100834221743,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85.1503186622858,852.689856233106,969.691099425755,714.606879283238,297.809865152961,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,177.407625148171,189.915376061973,113.003276997528,16.641102668945,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.338784610714548,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13.645102935061,128.694586354453,216.587357637178,281.908727255171,327.756006769223,355.924236586936,367.705305584723,364.771349130777,349.577182721124,325.208662311349,294.937363113374,261.770627462831,228.157578413693,195.879752361758,166.081855392401,139.379685761172,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,70.6147445757069,235.305879435999,349.362378304668,420.787498095829,456.789792767669,464.291224261243,450.125408729948,420.829035701327,382.248993878956,339.211676940379,295.376640064705,253.27475864013,214.469305335815,179.769591003012,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39.2806148465479,175.632177649136,261.861899973002,308.425007465946,324.897420999934,319.861400858854,300.658266236672,273.202740270281,241.955970488129,210.051499031398,179.51658654898,151.525624486731,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8.7416193399049,71.8739735101626,107.230126605983,122.899040655638,125.381314318598,119.651920289852,109.329540362832,96.9107819079322,84.0207716882685,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.94699943497835,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.242260355368671,0.615334085648101,0.759298016913817,
//            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.85645640218718,6.28377676447235,8.4427773557527,9.077034045039,8.79126704727332,8.01889142159143,7.04231652764838,6.03043659007244,5.07497509328277,
//            16.7217643562763,16.7174033727788,16.6167115532007,15.3881646130612,6.4559379186685,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21.8329084099514,36.8532192318744,24.3127247860066,9.53715964067487,0.990599143509826,0,4.09726861835588,10.685922084409,16.9663433297665,21.3903807696915,23.5111115053169,23.607005752001,22.2634923819678,20.0832314116715,17.5475075065733,14.9832701490968,12.583024935695,10.4412971992588,8.58934141723603,
//             };
//        #endregion
//        public static Bitmap bitmap;
//        public const int width = 64;
//        public const int height = 64;
//        public static Bitmap bitmapcopy;
//        public static System.Drawing.Point[] pointRound { get; set; }
//        public static int[,] integers = new int[width, height];

//        #region PointAppend
//        public static System.Drawing.Point[] PointAppend()
//        {
//            System.Drawing.Point p0 = new System.Drawing.Point(22, 41);
//            System.Drawing.Point p1 = new System.Drawing.Point(19, 41);
//            System.Drawing.Point p2 = new System.Drawing.Point(18, 41);
//            System.Drawing.Point p3 = new System.Drawing.Point(16, 40);
//            System.Drawing.Point p4 = new System.Drawing.Point(14, 38);
//            System.Drawing.Point p5 = new System.Drawing.Point(12, 37);
//            System.Drawing.Point p6 = new System.Drawing.Point(12, 36);
//            System.Drawing.Point p7 = new System.Drawing.Point(11, 35);
//            System.Drawing.Point p8 = new System.Drawing.Point(11, 34);
//            System.Drawing.Point p9 = new System.Drawing.Point(11, 33);
//            System.Drawing.Point p10 = new System.Drawing.Point(11, 31);
//            System.Drawing.Point p11 = new System.Drawing.Point(12, 30);
//            System.Drawing.Point p12 = new System.Drawing.Point(13, 29);
//            System.Drawing.Point p13 = new System.Drawing.Point(14, 28);
//            System.Drawing.Point p14 = new System.Drawing.Point(15, 28);
//            System.Drawing.Point p15 = new System.Drawing.Point(16, 27);
//            System.Drawing.Point p16 = new System.Drawing.Point(16, 26);
//            System.Drawing.Point p17 = new System.Drawing.Point(17, 26);
//            System.Drawing.Point p18 = new System.Drawing.Point(18, 26);
//            System.Drawing.Point p19 = new System.Drawing.Point(18, 26);
//            System.Drawing.Point p20 = new System.Drawing.Point(19, 26);
//            System.Drawing.Point p21 = new System.Drawing.Point(21, 26);
//            System.Drawing.Point p22 = new System.Drawing.Point(22, 26);
//            System.Drawing.Point p23 = new System.Drawing.Point(24, 26);
//            System.Drawing.Point p24 = new System.Drawing.Point(25, 27);
//            System.Drawing.Point p25 = new System.Drawing.Point(27, 28);
//            System.Drawing.Point p26 = new System.Drawing.Point(29, 28);
//            System.Drawing.Point p27 = new System.Drawing.Point(30, 30);
//            System.Drawing.Point p28 = new System.Drawing.Point(32, 31);
//            System.Drawing.Point p29 = new System.Drawing.Point(32, 31);
//            System.Drawing.Point p30 = new System.Drawing.Point(33, 32);
//            System.Drawing.Point p31 = new System.Drawing.Point(34, 33);
//            System.Drawing.Point p32 = new System.Drawing.Point(35, 34);
//            System.Drawing.Point p33 = new System.Drawing.Point(36, 34);
//            System.Drawing.Point p34 = new System.Drawing.Point(37, 36);
//            System.Drawing.Point p35 = new System.Drawing.Point(38, 37);
//            System.Drawing.Point p36 = new System.Drawing.Point(38, 39);
//            System.Drawing.Point p37 = new System.Drawing.Point(39, 40);
//            System.Drawing.Point p38 = new System.Drawing.Point(39, 41);
//            System.Drawing.Point p39 = new System.Drawing.Point(40, 42);
//            System.Drawing.Point p40 = new System.Drawing.Point(40, 43);
//            System.Drawing.Point p41 = new System.Drawing.Point(40, 44);
//            System.Drawing.Point p42 = new System.Drawing.Point(40, 44);
//            System.Drawing.Point p43 = new System.Drawing.Point(40, 44);
//            System.Drawing.Point p44 = new System.Drawing.Point(40, 45);
//            System.Drawing.Point p45 = new System.Drawing.Point(39, 45);
//            System.Drawing.Point p46 = new System.Drawing.Point(39, 46);
//            System.Drawing.Point p47 = new System.Drawing.Point(38, 47);
//            System.Drawing.Point p48 = new System.Drawing.Point(38, 47);
//            System.Drawing.Point p49 = new System.Drawing.Point(38, 47);
//            System.Drawing.Point p50 = new System.Drawing.Point(38, 47);
//            System.Drawing.Point p51 = new System.Drawing.Point(37, 47);
//            System.Drawing.Point p52 = new System.Drawing.Point(36, 47);
//            System.Drawing.Point p53 = new System.Drawing.Point(35, 47);
//            System.Drawing.Point p54 = new System.Drawing.Point(35, 47);
//            System.Drawing.Point p55 = new System.Drawing.Point(33, 47);
//            System.Drawing.Point p56 = new System.Drawing.Point(33, 47);
//            System.Drawing.Point p57 = new System.Drawing.Point(32, 46);
//            System.Drawing.Point p58 = new System.Drawing.Point(31, 46);
//            System.Drawing.Point p59 = new System.Drawing.Point(30, 45);
//            System.Drawing.Point p60 = new System.Drawing.Point(30, 45);
//            System.Drawing.Point p61 = new System.Drawing.Point(29, 44);
//            System.Drawing.Point p62 = new System.Drawing.Point(28, 43);
//            System.Drawing.Point p63 = new System.Drawing.Point(27, 43);
//            System.Drawing.Point p64 = new System.Drawing.Point(26, 42);
//            System.Drawing.Point p65 = new System.Drawing.Point(26, 42);
//            System.Drawing.Point p66 = new System.Drawing.Point(26, 42);
//            System.Drawing.Point p67 = new System.Drawing.Point(25, 42);
//            System.Drawing.Point p68 = new System.Drawing.Point(25, 42);
//            System.Drawing.Point p69 = new System.Drawing.Point(25, 42);
//            System.Drawing.Point p70 = new System.Drawing.Point(25, 42);
//            System.Drawing.Point p71 = new System.Drawing.Point(24, 42);
//            System.Drawing.Point p72 = new System.Drawing.Point(24, 42);
//            System.Drawing.Point p73 = new System.Drawing.Point(24, 41);
//            System.Drawing.Point p74 = new System.Drawing.Point(24, 41);
//            System.Drawing.Point p75 = new System.Drawing.Point(24, 41);
//            System.Drawing.Point p76 = new System.Drawing.Point(24, 41);
//            System.Drawing.Point p77 = new System.Drawing.Point(24, 41);
//            System.Drawing.Point p78 = new System.Drawing.Point(22, 41);

//            System.Drawing.Point[] pointRound = { p78, p77, p76, p75, p74, p73, p72, p71, p70, p69, p68, p67, p66, p65, p64, p63, p62, p61, p60, p59, p58, p57, p56, p55, p54, p53, p52, p51, p50, p49, p48, p47, p46, p45, p44, p43, p42, p41, p40, p39, p38, p37, p36, p35, p34, p33, p32, p31, p30, p29, p28, p27, p26, p25, p24, p23, p22, p21, p20, p19, p18, p17, p16, p15, p14, p13, p12, p11, p10, p9, p8, p7, p6, p5, p4, p3, p2, p1, p0 };

//            return pointRound;
//        }
//        #endregion

//        public static Graphics g;

//        public MainWindow()
//        {
//            InitializeComponent();
//            pointRound = PointAppend();
//            BitmapSource bi2 = MethodRound();
//            myimageCont1.Source = bi2;

//            SolidBrush redBrush = new SolidBrush(Color.Red);
//            g = Graphics.FromImage(bitmap);
//            g.FillPolygon(redBrush, pointRound);
//            //创建GDI对象，返回指针。
//            IntPtr myImagePtr = bitmap.GetHbitmap();
//            //创建imageSource
//            myimageCont2.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(myImagePtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
//            DeleteObject(myImagePtr);
//            string ShowRedBrush = String.Format("({0,-3},{1,3},{2,3})\n", redBrush.Color.R.ToString(), redBrush.Color.G.ToString(), redBrush.Color.B.ToString());
//            text.Text += ShowRedBrush;
//            for (int X = 0; X < width; X++)
//            {
//                for (int Y = 0; Y < height; Y++)
//                {
//                    if (bitmap.GetPixel(Y, X).Equals(bitmapcopy.GetPixel(Y, X)))
//                    {
//                        //string tmp = String.Format("({0,-4},{1,4})", Y, X);
//                        string tmpColor = String.Format("({0,-3},{1,3},{2,3}),({3},{4},{5})\t", bitmap.GetPixel(Y, X).R.ToString(), bitmap.GetPixel(Y, X).G.ToString(), bitmap.GetPixel(Y, X).B.ToString(),
//                            BitConverter.GetBytes(integers[Y,X])[0], BitConverter.GetBytes(integers[Y, X])[1], BitConverter.GetBytes(integers[Y, X])[2]);
//                        text.Text += tmpColor;
//                    }
//                }
//                text.Text += "\n";
//            }
//        }

//        [System.Runtime.InteropServices.DllImport("gdi32.dll")]
//        public static extern bool DeleteObject(IntPtr hObject);

//        public static BitmapSource MethodRound()
//        {
//            int[] dataInt = Array.ConvertAll(bitData, value => Convert.ToInt32(value));
//            int width = (int)Math.Pow(dataInt.Length, 0.5);
//            int height = (int)Math.Pow(dataInt.Length, 0.5);
//            int tmp = 0;
//            int stride = width * 4;

//            BitmapSource imagesource;
//            PointAppend();

//            for (int X = 0; X < width; X++)
//            {
//                for (int Y = 0; Y < height; Y++)
//                {
//                    tmp = dataInt[X * width + Y];
//                    byte[] rgba = new byte[] { (byte)255,(byte)0,(byte)(tmp * 255 / dataInt.Max()),255 };
//                    if (pointRound.Contains(new System.Drawing.Point(X, Y)))
//                        rgba = new byte[] { (byte)105, (byte)100, (byte)100, 255 };
//                    integers[Y, X] = BitConverter.ToInt32(rgba, 0);                 
//                }
//            }
//            //16776961

//            unsafe
//            {
//                fixed (int* intPtr = &integers[0, 0])
//                {
//                    bitmap = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format32bppRgb, new IntPtr(intPtr));
//                    bitmapcopy = new Bitmap(width, height, stride, System.Drawing.Imaging.PixelFormat.Format32bppRgb, new IntPtr(intPtr));

//                    IntPtr myImagePtr = bitmap.GetHbitmap();//创建GDI对象，返回指针
//                    //创建imageSource
//                    imagesource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(myImagePtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
//                    DeleteObject(myImagePtr);
//                }
//            }
//            return imagesource;
//        }

//    }
//}
